package com.chen.controller;

import com.chen.utils.JwtUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @PostMapping("/login")
    public String login(String username,String password){
        if(username.equals("admin") && password.equals("123")){
            //正确生成token
            String token = JwtUtils.getToken(username);
            return token;
        }else {
            return "账号密码错误";
        }
    }
}

